{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin static %}
{% load nomcom_tags %}
{% load ietf_filters %}
{% block pagehead %}
    <link rel="stylesheet" href="{% static "ietf/css/list.css" %}">
{% endblock %}
{% block title %}
    NomCom {{ year }} Private
    {% block subtitle %}{% endblock %}
{% endblock %}
{% block content %}
    {% origin %}
    {% with selected=request.path|split:'/'|slice:'4:-1'|join:'-' %}
    <h1>
        NomCom {{ year }}
        {% if nomcom.group.state_id == 'conclude' %}<span class="badge rounded-pill text-bg-info">Concluded</span>{% endif %}
        <br>
        <small class="text-body-secondary">Private area
            {% if is_chair_task %}- Chair/Advisors only{% endif %}
        </small>
    </h1>
    <ul class="nav nav-tabs my-3">
        <li class="nav-item">
            <a class="nav-link {% if selected == '' %}active{% endif %}"
               href="{% url "ietf.nomcom.views.private_index" year %}">
                Nominees
            </a>
        </li>
        {% if nomcom|has_publickey %}
            <li class="nav-item">
                <a class="nav-link {% if selected == 'nominate' %}active{% endif %}"
                   href="{% url 'ietf.nomcom.views.private_nominate' year %}">
                    Nominate
                </a>
            </li>
        {% endif %}
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle {% if selected in 'feedback,view-feedback'|split:',' %}active{% endif %}" data-bs-toggle="dropdown" href="#">Feedback</a>
            <ul class="dropdown-menu mt-n1" role="menu">
            {% if nomcom|has_publickey %}
            <li>
                <a class="dropdown-item {% if selected == 'feedback' %}active{% endif %}"
                   href="{% url 'ietf.nomcom.views.private_feedback' year %}">
                    Enter feedback
                </a>
            </li>
            {% endif %}
            <li>
                <a class="dropdown-item {% if selected == 'view-feedback' %}active{% endif %}"
                   href="{% url 'ietf.nomcom.views.view_feedback' year %}">
                    View feedback
                </a>
            </li>
            </ul>
        </li>
        <li class="nav-item">
            <a class="nav-link {% if selected == 'key' %}active{% endif %}"
               href="{% url 'ietf.nomcom.views.private_key' year %}">
                Private key
            </a>
        </li>
        {% if user|is_chair_or_advisor:year %}
            <li class="nav-item">
                <a class="nav-link {% if selected == 'view-feedback-pending' %}active{% endif %}"
                   href="{% url 'ietf.nomcom.views.view_feedback_pending' year %}">
                    Pending emails
                    {% if nomcom.pending_email_count %}<span class="badge rounded-pill text-bg-primary">{{ nomcom.pending_email_count }}</span>{% endif %}
                </a>
            </li>
            <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle {% if selected in 'feedback-email,questionnaire-response,extract-email-lists,send-reminder-mail-accept,send-reminder-mail-questionnaire,merge-person,merge-nominee,edit-nomcom,chair-templates,chair-position,chair-topic,edit-members,help'|split:',' %}active{% endif %}" data-bs-toggle="dropdown" href="#">Chair/advisor tasks</a>
                <ul class="dropdown-menu mt-n1" role="menu">
                    {% if nomcom.group.state_id == 'active' %}
                        <li role="presentation" class="dropdown-header">Feedback Management</li>
                        <li>
                            <a class="dropdown-item {% if selected == 'feedback-email' %}active{% endif %}" href="{% url 'ietf.nomcom.views.private_feedback_email' year %}">Enter email feedback</a>
                        </li>
                        <li>
                            <a class="dropdown-item {% if selected == 'questionnaire-response' %}active{% endif %}" href="{% url 'ietf.nomcom.views.private_questionnaire' year %}">Enter questionnaire response</a>
                        </li>
                        <li>
                            <a class="dropdown-item {% if selected == 'extract-email-lists' %}active{% endif %}" href="{% url 'ietf.nomcom.views.extract_email_lists' year %}">Extract email lists</a>
                        </li>
                        <li>
                            <a class="dropdown-item {% if selected == 'send-reminder-mail-accept' %}active{% endif %}" href="{% url 'ietf.nomcom.views.send_reminder_mail' year "accept" %}">Send accept reminder</a>
                        </li>
                        <li>
                            <a class="dropdown-item {% if selected == 'send-reminder-mail-questionnaire' %}active{% endif %}" href="{% url 'ietf.nomcom.views.send_reminder_mail' year "questionnaire" %}">Send questionnaire reminder</a>
                        </li>
                        <li>
                            <a class="dropdown-item {% if selected == 'merge-person' %}active{% endif %}" href="{% url "ietf.nomcom.views.private_merge_person" year %}">Request person record merge</a>
                        </li>
                        <li>
                            <a class="dropdown-item {% if selected == 'merge-nominee' %}active{% endif %}" href="{% url "ietf.nomcom.views.private_merge_nominee" year %}">Merge nominee records</a>
                        </li>
                        <li><hr class="dropdown-divider"></li>
                    {% endif %}
                    <li role="presentation" class="dropdown-header">NomCom configuration</li>
                    <li>
                        <a class="dropdown-item {% if selected == 'edit-nomcom' %}active{% endif %}" href="{% url 'ietf.nomcom.views.edit_nomcom' year %}">Edit settings</a>
                    </li>
                    <li>
                        <a class="dropdown-item {% if selected == 'chair-templates' %}active{% endif %}" href="{% url 'ietf.nomcom.views.list_templates' year %}">Edit pages</a>
                    </li>
                    <li>
                        <a class="dropdown-item {% if selected == 'chair-position' %}active{% endif %}" href="{% url 'ietf.nomcom.views.list_positions' year %}">Edit positions</a>
                    </li>
                    <li>
                        <a class="dropdown-item {% if selected == 'chair-topic' %}active{% endif %}" href="{% url 'ietf.nomcom.views.list_topics' year %}">Edit topics</a>
                    </li>
                    {% if nomcom.group.state_id == 'active' %}
                        <li>
                            <a class="dropdown-item {% if selected == 'edit-members' %}active{% endif %}" href="{% url 'ietf.nomcom.views.edit_members' year %}">Edit members</a>
                        </li>
                    {% endif %}
                    <li>
                        <a class="dropdown-item {% if selected == 'help' %}active{% endif %}" href="{% url 'ietf.nomcom.views.configuration_help' year %}">Configuration help</a>
                    </li>
                    <li><hr class="dropdown-divider"></li>
                    <li role="presentation" class="dropdown-header">Other tools</li>
                    <li>
                        <a class="dropdown-item" href="{% url 'ietf.secr.announcement.views.main' %}">Announcement tool</a>
                    </li>
                </ul>
            </li>
        {% endif %}
        {% if user|is_chair_or_advisor:year or user|has_role:"Secretariat" %}
            <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle {% if selected in 'chair-eligible,chair-volunteers'|split:',' %}active{% endif %}" data-bs-toggle="dropdown" href="#">
                    Volunteers
                </a>
                <ul class="dropdown-menu mt-n1" role="menu">
                    <li>
                        <a class="dropdown-item {% if selected == 'chair-eligible' %}active{% endif %}" href="{% url 'ietf.nomcom.views.private_eligible' year %}">
                            View eligible
                        </a>
                    </li>
                    <li>
                        <a class="dropdown-item {% if selected == 'chair-volunteers' %}active{% endif %}" href="{% url 'ietf.nomcom.views.private_volunteers' year %}">
                            View volunteers
                        </a>
                    </li>
                </ul>
            </li>
        {% endif %}
        <li class="nav-item">
            <a class="nav-link"
               href="/nomcom/{{ nomcom.year }}">
                Public pages &raquo;
            </a>
        </li>
    </ul>
    {% block nomcom_content %}{% endblock %}
    {% endwith %}
{% endblock %}
{% block js %}
    <script src="{% static "ietf/js/list.js" %}"></script>
    <script>
        // Javascript to enable link to tab
        var url=document.location.toString();
        if (url.match('#')) {
            $('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
        }
        // Change hash for page-reload
        $('.nav-tabs a').on('shown.bs.tab', function (e) {
            window.location.hash=e.target.hash;
        })
    </script>
{% endblock %}